<? include 'server_config.php'; 

if($_SESSION['user_idx'] == "")
{
	?>
	<script>
		location.href='login.php';
	</script>
	<?
	return;
}

$document_idx = $_GET['idx'];
?>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<?

$sql = "
SELECT user_idx
FROM ndd_document
WHERE 
document_idx = '$document_idx' ;
";

//echo $sql;
$result = mysql_query($sql,$connect);
$row = mysql_fetch_row($result);

if($_SESSION['user_idx'] != $row[0] || $document_idx=="")
{
	return;
}

$sql = "
DELETE FROM ndd_comment
WHERE 
document_idx = '$document_idx';
";

//echo $sql;
$result = mysql_query($sql,$connect);

$sql = "
DELETE FROM ndd_file
WHERE 
document_idx = '$document_idx';
";

//echo $sql;
//$result = mysql_query($sql,$connect);

$sql = "
DELETE FROM ndd_document WHERE document_idx = '$document_idx';
";

//echo $sql;
$result = mysql_query($sql,$connect);



?>

<script> 
parent.location.reload();
//location.replace("<? echo $_POST['current_location']; ?>");
</script>











